package com.jaws.demo.vo;

import java.util.List;

import com.google.common.collect.Lists;

/**
 * 账户类型<br/>
 * PERSIONAL("001", "个人账户"), 
 * ENTERPRISE("002", "企业户"), 
 * YJF("101", "友金服(平台商户号)"), 
 * JF_HK("102", "金服还款户"), 
 * JF_BFJ("103", "金服备用金户"), 
 * JF_SR("104", "金服收入户"), 
 * JF_DS("105", "金服代收付户"), 
 * JF_YXZC("106", "金服营销支出户"), 
 * JF_WC("107", "尾差户"), 
 * JK_SR("108", "金控收入户"), 
 * PH_DSF("109", "普惠代收付户"), 
 * PH_SR("110", "普惠收入户"), 
 * RZDB_SR("111", "融资担保户"), 
 * FRZDB_SR("112", "非融资担保户"), 
 * 
 * @author maojian
 * @date 2017-05-23 18:05:42
 * @since v1.0.0
 */
public enum AccountTypeEnum {
	PERSIONAL("001", "个人账户"), 
	ENTERPRISE("002", "企业户"), 
	YJF("101", "友金服(平台商户号)"), 
	JF_HK("102", "金服还款户"), 
	JF_BFJ("103", "金服备用金户"), 
	JF_SR("104", "金服收入户"), 
	JF_DS("105", "金服代收付户"), 
	JF_YXZC("106", "金服营销支出户"), 
	JF_WC("107", "尾差户"), 
	JK_SR("108", "金控收入户"), 
	PH_DSF("109", "普惠代收付户"), 
	PH_SR("110", "普惠收入户"),
	RZDB("111", "融资担保户"),
	FRZDB("112", "非融资担保户"),
	;

	private AccountTypeEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	/**
	 * 是否平台相关账户
	 * 
	 * @author maojian
	 * @date 2017-05-31 10:50:55
	 * @since v1.0.0
	 *
	 * @return
	 */
	public boolean isPlatformAccount() {
		if (this.equals(AccountTypeEnum.YJF) || this.equals(AccountTypeEnum.JF_HK) 
				|| this.equals(AccountTypeEnum.JF_BFJ) || this.equals(AccountTypeEnum.JF_SR)
				|| this.equals(AccountTypeEnum.JF_DS) || this.equals(AccountTypeEnum.JF_YXZC)
				|| this.equals(AccountTypeEnum.JF_WC) || this.equals(AccountTypeEnum.JK_SR) 
				|| this.equals(AccountTypeEnum.PH_DSF)|| this.equals(AccountTypeEnum.PH_SR) 
				|| this.equals(AccountTypeEnum.RZDB)
				|| this.equals(AccountTypeEnum.FRZDB)) {
			return true;
		}
		return false;
	}
	
	public static List<String> getPlatformAccountTyps(){
		List<String> accountTypes = Lists.newArrayList();
		for(AccountTypeEnum type : AccountTypeEnum.values()){
			if(type.isPlatformAccount()){
				accountTypes.add(type.getCode());
			}
		}
		return accountTypes;
	}

	private String code;
	private String name;

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
	
}
